<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>">
	<meta charset="utf-8" />
	<title></title>
	<meta name="description" content="overview & stats" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<link href="static/css/bootstrap.min.css" rel="stylesheet" />
	<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="static/css/font-awesome.min.css" />
	<link rel="stylesheet" href="static/css/chosen.css" />
	<link rel="stylesheet" href="static/css/ace.min.css" />
	<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
	<link rel="stylesheet" href="static/css/ace-skins.min.css" />
	<link rel="stylesheet" href="static/css/datepicker.css" /><!-- 日期框 -->
	<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
	<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
		
	<script type="text/javascript">
		//保存
		function save(){
			var gift_store_number = $("#gift_store_number").val();
			
			if(isNaN(gift_store_number)){
				$("#gift_store_number").tips({
					side:3,
		            msg:'库存数量必须是数值',
		            bg:'#AE81FF',
		            time:3
		        });
				$("#gift_store_number").focus();
				return false;
			}
			
			var exchange_number = $("#exchange_number").val();
			
			if(isNaN(exchange_number)){
				$("#exchange_number").tips({
					side:3,
		            msg:'礼品兑换所需初吻币数量必须是数值',
		            bg:'#AE81FF',
		            time:3
		        });
				$("#exchange_number").focus();
				return false;
			}
			
			var attr_1 = $("#attr_1").val();
			if(attr_1 != null){
				if(isNaN(attr_1)){
					$("#attr_1").tips({
						side:3,
			            msg:'可兑换流量值必须是数值',
			            bg:'#AE81FF',
			            time:3
			        });
					$("#attr_1").focus();
					return false;
				}
			}
			
			var rate = $("#rate").val();
			if(rate != null){
				if(isNaN(rate)){
					$("#rate").tips({
						side:3,
			            msg:'中奖比例必须是数值',
			            bg:'#AE81FF',
			            time:3
			        });
					$("#rate").focus();
					return false;
				}
			}
			
			var lottery_amount = $("#lottery_amount").val();
			if(lottery_amount != null){
				if(isNaN(lottery_amount)){
					$("#lottery_amount").tips({
						side:3,
			            msg:'中奖比例必须是数值',
			            bg:'#AE81FF',
			            time:3
			        });
					$("#lottery_amount").focus();
					return false;
				}
			}
			
			$("#productGiftForm").submit();
			$("#centerOfMainFrame").hide();
			$("#centerOfMainFrame2").show();
		}
	</script>
	</head>
<body>
	<form action="product/gift/editProductGift.do" name="productGiftForm" id="productGiftForm" method="post">
	<input type="hidden" name="gift_id" id="gift_id" value="${productGift.gift_id }"/>
		<div id="centerOfMainFrame">
			<table id="table_report" class="table table-striped table-bordered table-hover">
				<tr>
					<td>库存数量(可不填):</td>
					<td>
						<input type="text" style="width:95%;" name="gift_store_number" id="gift_store_number" placeholder="这里输入库存数量" value="${productGift.gift_store_number }" title="库存数量"/>
					</td>
				</tr>
				<tr>
					<td>兑换需初吻币数、中奖初吻币数(可不填):</td>
					<td>
						<input type="text" style="width:95%;" name="exchange_number" id="exchange_number" placeholder="这里输入礼品兑换所需初吻币数" value="${productGift.exchange_number }" title="礼品兑换所需初吻币数"/>
					</td>
				</tr>
				<c:if test="${productGift.gift_type == '2' }">
					<tr>
						<td>可兑换流量值:</td>
						<td>
							<input type="text" style="width:95%;" name="attr_1" id="attr_1" placeholder="这里输入可兑换流量值" value="${productGift.attr_1 }" title="可兑换流量值"/>
						</td>
					</tr>
				</c:if>
				<tr>
					<td>应用对象:</td>
					<td>
						<select name="target_object" title="应用对象">
							<option value="1" <c:if test="${productGift.target_object == '1' }">selected</c:if> >APP平台</option>
							<option value="2" <c:if test="${productGift.target_object == '2' }">selected</c:if> >橘子洲电子音乐节</option>
							<option value="3" <c:if test="${productGift.target_object == '3' }">selected</c:if> >ALL</option>
							<option value="4" <c:if test="${productGift.target_object == '4' }">selected</c:if> >公众号抽奖</option>
							<option value="5" <c:if test="${productGift.target_object == '5' }">selected</c:if> >人气票选抽奖</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>礼品类型:</td>
					<td>
						<select name="gift_type" title="礼品类型">
							<option value="1" <c:if test="${productGift.gift_type == '1' }">selected</c:if> >实物礼物</option>
							<option value="2" <c:if test="${productGift.gift_type == '2' }">selected</c:if> >虚拟礼物</option>
							<option value="3" <c:if test="${productGift.gift_type == '3' }">selected</c:if> >虚拟赠送礼物</option>
							<option value="4" <c:if test="${productGift.gift_type == '4' }">selected</c:if> >实物奖品</option>
							<option value="5" <c:if test="${productGift.gift_type == '5' }">selected</c:if> >虚拟奖品</option>
							<option value="6" <c:if test="${productGift.gift_type == '6' }">selected</c:if> >微信红包</option>
							<option value="7" <c:if test="${productGift.gift_type == '7' }">selected</c:if> >APP现金红包</option>
						</select>
					</td>
				</tr>
				<c:if test="${productGift.target_object != '1'}">
				<tr>
					<td>应用时间:</td>
					<td>
						<select name="target_date_type" title="应用时间">
							<option value="1" <c:if test="${productGift.target_date_type == '1' }">selected</c:if> >全部</option>
							<option value="2" <c:if test="${productGift.target_date_type == '2' }">selected</c:if> >周末</option>
							<option value="3" <c:if test="${productGift.target_date_type == '3' }">selected</c:if> >非周末</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>中奖金额(微信红包|可不填):</td>
					<td>
						<input type="text" style="width:95%;" name="lottery_amount" id="lottery_amount" placeholder="这里输入礼品中奖金额" value="${productGift.lottery_amount }" title="礼品中奖比例"/>
					</td>
				</tr>
				<tr>
					<td>奖品中奖比例(可不填):</td>
					<td>
						<input type="text" style="width:95%;" name="rate" id="rate" placeholder="这里输入礼品中奖比例" value="${productGift.rate }" title="礼品中奖比例"/>
					</td>
				</tr>
				<tr>
					<td>中奖推送语(可不填):</td>
					<td>
						<textarea  style="width:93%;height:290px" name="push_msg" id="push_msg">${productGift.push_msg }</textarea>
					</td>
				</tr>
				</c:if>
				<tr>
					<td>礼品标题(可不填):</td>
					<td>
						<textarea  style="width:93%;height:290px" name="remark" id="remark">${productGift.remark }</textarea>
					</td>
				</tr>
				<tr>
					<td>礼品描述(可不填):</td>
					<td>
						<textarea  style="width:93%;height:290px" name="description" id="description">${productGift.description }</textarea>
					</td>
				</tr>
				<tr>
					<td class="center" colspan="2">
						<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
						<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
					</td>
				</tr>
			</table>
		</div>
		<div id="centerOfMainFrame2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div>
	</form>
	
	<!-- 引入 -->
	<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
	<script type="text/javascript" src="static/js/ace.min.js"></script>
	<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 单选框 -->
	<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
	<!-- 编辑框-->
	<script type="text/javascript" charset="utf-8">window.UEDITOR_HOME_URL = "<%=path%>/plugins/ueditor/";</script>
	<script type="text/javascript" charset="utf-8" src="plugins/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="plugins/ueditor/ueditor.all.js"></script>
	<!-- 编辑框-->
	<script type="text/javascript">
	$(top.hangge());
	$(function() {
		
		//单选框
		$(".chzn-select").chosen(); 
		$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
		
		//日期框
		$('.date-picker').datepicker();
	});
	</script>
</body>
</html>